#!/usr/bin/python3
# -*- coding: utf-8 -*-

"""
# @version: v1.0
# @author : wlisingle
# @Email : 19688513@qq.com
# @Project : g-carbon-bio
# @File : stock_trade_base.py
# @Software: PyCharm
# @time: 2025/2/18 9:09
# @description : 
"""

from datetime import datetime


class StockTradeBase:
    def __init__(self, stock_id: int, s_code: str, t_rate: float, v_ratio: float, o_disk: float, i_disk: float, creation_time=None):
        """
        初始化股票对象

        :param stock_id: 股票的唯一标识符（整数）
        :param s_code: 股票代码（字符串）
        :param t_rate: 换手率（浮点数）
        :param v_ratio: 量比（浮点数）
        :param o_disk: 外盘（整数）
        :param i_disk: 内盘（整数）
        """
        self._id = stock_id
        self._s_code = s_code
        self._t_rate = t_rate
        self._v_ratio = v_ratio
        self._o_disk = o_disk
        self._i_disk = i_disk
        # 添加创建时间
        if creation_time is None:
            self._creation_time = datetime.now().strftime("%Y-%m-%d %p")
        else:
            self._creation_time = creation_time

    @property
    def id(self) -> int:
        """获取股票的唯一标识符"""
        return self._id

    @id.setter
    def id(self, _id: int) -> None:
        """设置股票的唯一标识符"""
        self._id = _id

    @property
    def s_code(self) -> str:
        """获取股票代码"""
        return self._s_code

    @s_code.setter
    def s_code(self, s_code: str) -> None:
        """设置股票代码"""
        self._s_code = s_code

    @property
    def t_rate(self) -> float:
        """获取换手率"""
        return self._t_rate

    @t_rate.setter
    def t_rate(self, t_rate: float) -> None:
        """设置换手率"""
        self._t_rate = t_rate

    @property
    def v_ratio(self) -> float:
        """获取量比"""
        return self._v_ratio

    @v_ratio.setter
    def v_ratio(self, v_ratio: float) -> None:
        """设置量比"""
        self._v_ratio = v_ratio

    @property
    def o_disk(self) -> float:
        """获取外盘"""
        return self._o_disk

    @o_disk.setter
    def o_disk(self, o_disk: float) -> None:
        """设置外盘"""
        self._o_disk = o_disk

    @property
    def i_disk(self) -> float:
        """获取内盘"""
        return self._i_disk

    @i_disk.setter
    def i_disk(self, i_disk: str) -> None:
        """设置内盘"""
        self._i_disk = i_disk

    @property
    def creation_time(self):
        """
        获取创建时间

        Returns:
            str: 创建时间的字符串表示
        """
        return self._creation_time

    @creation_time.setter
    def creation_time(self, value):
        """
        设置创建时间

        Args:
            value (str): 创建时间
        """
        self._creation_time = value